/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.zx.course.study.service;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeesite.common.entity.Page;
import com.jeesite.common.service.CrudService;
import com.jeesite.modules.zx.course.study.entity.ZxCourseStudy;
import com.jeesite.modules.zx.course.study.dao.ZxCourseStudyDao;
import com.jeesite.modules.file.utils.FileUploadUtils;

/**
 * 课程学习表Service
 * @author zpp
 * @version 2020-02-11
 */
@Service
@Transactional(readOnly=true)
public class ZxCourseStudyService extends CrudService<ZxCourseStudyDao, ZxCourseStudy> {
	
	/**
	 * 获取单条数据
	 * @param zxCourseStudy
	 * @return
	 */
	@Override
	public ZxCourseStudy get(ZxCourseStudy zxCourseStudy) {
		return super.get(zxCourseStudy);
	}
	
	/**
	 * 查询分页数据
	 * @param zxCourseStudy 查询条件
	 * @param zxCourseStudy.page 分页对象
	 * @return
	 */
	@Override
	public Page<ZxCourseStudy> findPage(ZxCourseStudy zxCourseStudy) {
		return super.findPage(zxCourseStudy);
	}
	
	/**
	 * 保存数据（插入或更新）
	 * @param zxCourseStudy
	 */
	@Override
	@Transactional(readOnly=false)
	public void save(ZxCourseStudy zxCourseStudy) {
		super.save(zxCourseStudy);
		// 保存上传图片
		FileUploadUtils.saveFileUpload(zxCourseStudy.getId(), "zxCourseStudy_image");
		// 保存上传附件
		FileUploadUtils.saveFileUpload(zxCourseStudy.getId(), "zxCourseStudy_file");
	}
	
	/**
	 * 更新状态
	 * @param zxCourseStudy
	 */
	@Override
	@Transactional(readOnly=false)
	public void updateStatus(ZxCourseStudy zxCourseStudy) {
		super.updateStatus(zxCourseStudy);
	}
	
	/**
	 * 删除数据
	 * @param zxCourseStudy
	 */
	@Override
	@Transactional(readOnly=false)
	public void delete(ZxCourseStudy zxCourseStudy) {
		dao.phyDelete(zxCourseStudy);
	}
	
}